<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {% load static %}
    <link rel="stylesheet" href="{% static 'polls/style.css' %}">
    <title>投票主题列表</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            font-family: 'Helvetica Neue', Arial, sans-serif;
            line-height: 1.6;
            background-color: #f8f9fa;
            color: #333;
            padding: 20px;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
            padding: 30px;
        }
        h1 {
            color: #2c3e50;
            margin-bottom: 25px;
            padding-bottom: 10px;
            border-bottom: 2px solid #3498db;
            font-size: 28px;
        }
        .poll-list {
            list-style: none;
            margin-bottom: 30px;
        }
        .poll-item {
            padding: 15px;
            margin-bottom: 10px;
            background: #f8f9fa;
            border-radius: 6px;
            transition: all 0.3s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .poll-item:hover {
            background: #e9ecef;
            transform: translateX(5px);
        }
        .poll-link {
            color: #2c3e50;
            text-decoration: none;
            font-weight: 500;
            flex-grow: 1;
        }
        .poll-link:hover {
            color: #3498db;
            text-decoration: underline;
        }
        .vote-tag {
            background: #3498db;
            color: white;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 14px;
            margin-left: 15px;
        }
        .no-polls {
            color: #6c757d;
            font-style: italic;
            padding: 15px;
            text-align: center;
        }
        .admin-link {
            display: inline-block;
            margin-top: 20px;
            padding: 10px 20px;
            background: #2c3e50;
            color: white;
            text-decoration: none;
            border-radius: 4px;
            transition: background 0.3s;
        }
        .admin-link:hover {
            background: #1a252f;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>请选择投票主题</h1>
        
        {% if latest_question_list %}
        <ul class="poll-list">
            {% for question in latest_question_list %}
            <li class="poll-item">
                <a href="{% url 'polls:detail' question.id %}" class="poll-link">
                    {{ question.question_text }}
                </a>
                <span class="vote-tag">投票</span>
            </li>
            {% endfor %}
        </ul>
        {% else %}
        <p class="no-polls">暂无投票主题</p>
        {% endif %}

        <a href="/admin" class="admin-link">后台管理</a>
    </div>
</body>
</html>